package com.hxit.huaxiamelongarden.utils;

import java.util.Random;

/**
 * @ClassName CaptchaUtil
 * @Author 12694
 * @Date 2025/1/21 12:00
 * @Version 1.0
 **/
public class CaptchaUtil {
    // 生成验证码文本
    public static String generateCaptchaText(int length) {
        String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
        Random random = new Random();
        StringBuilder captcha = new StringBuilder();

        for (int i = 0; i < length; i++) {
            int index = random.nextInt(chars.length());
            captcha.append(chars.charAt(index));
        }
        return captcha.toString();
    }
}
